﻿@using ZhouYu.DreamTour.Web.Models;
@{
    var UserInfo = UserInfoContext.userInfoContext.UserInfo;
}
<!DOCTYPE html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>中国梦想游-会员登录页</title>
    <link href="~/css/style.css" rel="stylesheet" type="text/css" />
    <link href="~/css/common.css" rel="stylesheet" type="text/css" />
    <link href="~/layui-v2.5.4/layui/css/layui.css" type="text/css"/>
</head>
<body>
    <div class="top_hw clearfix">
        <div class="top_h clearfix">
            <div class="top_hl"><span>欢迎来到中国梦想游，让你的梦想全程免费自由行！</span> 预定热线：<b>0571-63322269</b></div>
            <div class="top_hr">
                @if (UserInfo == null)
                {
                    <a href="/Home/User_Register">会员注册</a>
                    <span>|</span> <a href="/Home/User_Login">登录</a>
                    <span>|</span> <a href="#">梦想收藏</a> <span>|</span> <a href="#">设为首页</a>
                    @*<a>
                欢迎你，来到新世界旅行网！
            </a>*@
                }
                else
                {
                    <a href="/Home/User_Center">会员中心</a>
                    <span>|</span> <a href="#">梦想收藏</a> <span>|</span> <a href="#">设为首页</a> <span>|</span> <a href="/Login/LoginOut">退出</a> <span>|</span>
                    <a>
                        欢迎你，<span>@UserInfo.User_Name</span>来到新世界旅行网！
                    </a>
                }
            </div>
        </div>
    </div>
    <div class="head_w">
        <div class="head_t clearfix">
            <div class="logo"><img src="~/images/logo.jpg"></div>
            <div class="rx_line"><img src="~/images/rx.jpg"></div>
        </div>
    </div>
    <div class="mainNav clearfix">
        <ul class="Nav_ul">
            <li><a href="/Home/Index">首页</a><img src="~/images/nav_line.jpg"></li>
            <li><a href="/Home/Route">旅游路线</a><img src="~/images/nav_line.jpg"></li>
            <li><a href="/Home/Scenic">旅游景点</a><img src="~/images/nav_line.jpg"></li>
            <li><a href="/Home/CateringAccommodation">餐饮住宿</a><img src="~/images/nav_line.jpg"></li>
            <li><a href="/Home/Traffic_DatailsOne">交通线路</a><img src="~/images/nav_line.jpg"></li>
            <li><a href="/Home/Group">旅游团购</a><img src="~/images/nav_line.jpg"></li>
            <li><a href="/Home/Specialty">地方特产</a><img src="~/images/nav_line.jpg"></li>
            <li><a href="/Home/AutoGenerationIntro">自动生成简介</a><img src="~/images/nav_line.jpg"></li>
            <li><a href="/Home/Team_Join">团队简介</a><img src="~/images/nav_line.jpg"></li>
            <li><a href="/Home/Itinerary_Details">行程导航</a></li>
        </ul>
    </div>
    <div class="b_wrap">
        <div class="current"><span>当前所在地：</span><a href="/Home/Index">首页</a> >> <a href="/Home/User_Center">会员中心</a></div>
        <div class="fmember">
            <div class="fmleft">
                <div class="fmleft_top"><img src="~/images/fmbt1.png" border="0"></div>
                <div class="fmlist">
                    <ul>
                        <li class="f1">订单中心</li>
                        <li> >><a href="/Home/User_Order">我的订单</a> </li>
                        <li> >><a href="/Home/User_Colleague">发布结伴同行</a> </li>
                        <li> >><a href="/Home/User_Apply">我申请的结伴同行</a> </li>
                        <li> >><a href="/Home/User_Comment">我的点评</a> </li>
                        <li class="f2"> >><a href="/Home/User_Questions">我的提问</a> </li>
                    </ul>
                    <ul>
                        <li class="f1">我的优惠卡券</li>
                        <li> >><a href="/Home/User_CashAccount">现金账号</a> </li>
                        <li> >><a href="/Home/User_AllowanceVol">抵用券</a> </li>
                        <li class="f2"> >><a href="/Home/User_TouristVol">旅游券</a> </li>
                    </ul>
                    <ul>
                        <li class="f1">账户信息</li>
                        <li> >><a href="/Home/User_Data">个人资料</a> </li>
                        <li> >><a href="/Home/User_AccountSecurity">账户安全</a> </li>
                        <li>
                            >>
                            <a href="/Home/User_Bank">我的银行卡</a>
                        </li>
                        <li> >><a href="/Home/User_Integral">我的积分</a> </li>
                        <li> >><a href="/Home/User_UpdatePwd">修改密码</a> </li>
                        <li class="f2"> >><a href="/Home/User_Address">配送地址</a> </li>
                    </ul>
                </div>
            </div>
            <div class="fmright">
                <div class="fmr1">
                    <div class="fmr1_top">修改密码</div>
                    <div class="fmr1_m">
                        <div class="fcard">
                            <table border="0" cellpadding="0" cellspacing="0" width="636">
                                <tr>
                                    <td align="right" height="30">请输入账号当前的密码：</td>
                                    <td align="left" height="30"><input type="text" id="CurrentPassword" class="finput3">&nbsp;<span id="num"></span></td>
                                </tr>
                                <tr>
                                    <td align="right" height="30">请输入要修改的密码：</td>
                                    <td align="left" height="30"><input type="password" id="Password" class="finput3">&nbsp;<span id="num2"></span></td>
                                </tr>
                                <tr>
                                    <td align="right" height="30">请确认要修改的密码：</td>
                                    <td align="left" height="30"><input type="password" id="rPassword" class="finput3">&nbsp;<span id="num3"></span></td>
                                </tr>
                                <tr>
                                    <td colspan="2" align="center" valign="middle" height="50"><input id="btn" type="image" src="~/images/fbtn8.png"></td>
                                </tr>
                            </table>
                        </div>
                        <div class="fpw">安全问题</div>
                        <div class="fcard">
                            <table border="0" cellpadding="0" cellspacing="0" width="636">
                                <tr>
                                    <td align="right" height="30">问题一：</td>
                                    <td align="left" height="30"><select><option>-------选择问题-------</option></select></td>
                                </tr>
                                <tr>
                                    <td align="right" height="30">答案：</td>
                                    <td align="left" height="30"><input type="text" class="finput3"></td>
                                </tr>
                                <tr>
                                    <td align="right" height="30">问题二：</td>
                                    <td align="left" height="30"><select><option>-------选择问题-------</option></select></td>
                                </tr>
                                <tr>
                                    <td align="right" height="30">答案：</td>
                                    <td align="left" height="30"><input type="text" class="finput3"></td>
                                </tr>
                                <tr>
                                    <td align="right" height="30">问题三：</td>
                                    <td align="left" height="30"><select><option>-------选择问题-------</option></select></td>
                                </tr>
                                <tr>
                                    <td align="right" height="30">答案：</td>
                                    <td align="left" height="30"><input type="text" class="finput3"></td>
                                </tr>
                                <tr>
                                    <td colspan="2" align="center" valign="middle" height="50"><input type="image" src="~/images/fbtn8.png"></td>
                                </tr>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script src="~/js/jquery-3.3.1.min.js"></script>
    <script src="~/layui-v2.5.4/layui/layui.js"></script>
    <script src="~/layui-v2.5.4/layui/layui.all.js"></script>
    <script>
        $(function () {
           $("#Password").blur(function () {
                Pwd();
            });
            $("#rPassword").blur(function () {
                Rpwd();
            });
            $("#CurrentPassword").blur(function () {
                CurrentPassword();
            });
            $("#btn").click(function () {
                if (CurrentPassword()) {
                    if (Pwd()) {
                        if (Rpwd()) {
                            if ($("#Password").val() !=@UserInfo.User_Pwd) {
                                $.ajax({
                                    url: "/User/Changepwd?Pwd=" + $("#Password").val() + "&UserId=" +@UserInfo.User_Id,
                                    type: "post",
                                    success: function (result) {
                                        if (result.Success) {
                                              layer.msg('修改密码成功!');
                                            location.href = "/Login/LoginOut";

                                        }
                                        else {
                                            layer.msg('修改密码失败!');
                                          
                                        }
                                    }
                                })

                            } else {
                                  layer.msg('新密码不能和近期用过的密码相同');
                            }
                            }
                    }
                }
            })
        })
        function CurrentPassword() {
            if ($("#CurrentPassword").val() != "") {
                if ($("#CurrentPassword").val() !=@UserInfo.User_Pwd) {
                     $("#num").text("当前密码输入错误,请重试!");
                    $("#num").css("color", "red");

                    return false;
                } else {
                    $("#num").text("成功!");
                    $("#num").css("color", "green");
                    return true;
                }

              } else {
                $("#num").text("不能为空!");
                $("#num").css("color", "red");
                return false;
            }
        }
        //初次密码
        function Pwd() {
            if ($("#Password").val() != "") {
                //验证表达式
                var reg = /^(\w){6,20}$/;
                if (reg.test($("#Password").val())) {
                    $("#num2").text("成功!");
                    $("#num2").css("color", "green");
                    return true;
                } else {
                    $("#num2").text("*只能输入6-20个字母、数字、下划线！");
                    $("#num2").css("color", "red");
                    return false;
                }
                return true;
            } else {
                $("#num2").text("不能为空!");
                $("#num2").css("color", "red");
                return false;
            }
        }
        //判断2次密码是否相同
        function Rpwd() {
            if ($("#rPassword").val() != "") {
                if ($("#Password").val() == $("#rPassword").val()) {
                    $("#num3").text("成功!");
                    $("#num3").css("color", "green");
                    return true;
                } else {
                    $("#num3").text("两次密码要一致哦！");
                    $("#num3").css("color", "red");
                    return false;
                }

            } else {
                $("#num3").text("确认密码不能为空!");
                $("#num3").css("color", "red");
                return false;
            }

        }

    </script>
</body>
</html>

